package www.lagou.app;

import org.junit.Test;
import www.lagou.dao.accountDao;
import www.lagou.entity.account;
import www.lagou.entity.transaction;
import www.lagou.utils.DateUtils;

import java.sql.SQLException;

public class TestAccountDao {
    accountDao accountDao = new accountDao();


   @Test
   public void testInsertTransAction() throws SQLException {
       transaction t1 = new transaction();
       boolean b = accountDao.delTransaction("1122334455");
       boolean b1 = false;
       if(b){
           t1.setId(1);
           t1.setCardid("1122334455");
           t1.setTratype("转出");
           t1.setTramoney(5000.0);
           t1.setDATETIME(DateUtils.getDateFormat());
           b1 = accountDao.insertData(t1);
       }

       if(b1){
           System.out.println("操作成功");
       }else {
           System.out.println("操作失败!");
       }

       transaction t2 = new transaction();

       boolean b3 = accountDao.insTransaction("55443332211");
       boolean b4 = false;
       if(b3){
           t2.setId(2);
           t2.setCardid("55443332211");
           t2.setTratype("转入");
           t2.setTramoney(5000.0);
           t2.setDATETIME(DateUtils.getDateFormat());
           b4 = accountDao.insertData(t2);
       }

       if(b4){
           System.out.println("操作成功!");
       }else {
           System.out.println("操作失败");
       }



   }


}
